<template>
<MyContainer>
  <el-row :gutter="40">
    <el-col :span="5">
      <h1>总投递人数</h1>
      <h3><i>{{recruitCount}}人</i></h3>
    </el-col>
    <el-col :span="19">
      <BarChart :chartData="chartData" name="数量"/>
    </el-col>
  </el-row>
</MyContainer>
</template>

<script>
import BarChart from "@/views/dashboard/BarChart";
import {chart1,chart2} from "@/api/recruit/position";
import MyContainer from "@/components/Me/MyContainer";
import {deliveryChart} from "@/api/recruit/delivery";
export default {
  name: "Chart",
  components: {MyContainer, BarChart},
  data() {
    return {
      chartData: {},
      recruitCount: 0,
    }
  },
  methods: {
    chart() {
      deliveryChart().then((res) => {
        let xData=[]
        let sData=[]
        res.forEach(v=>{
          xData.push(v.v)
          sData.push(v.c)
        })
        //计算招聘人数
        this.recruitCount = sData.reduce((a,b)=>{
          return a+b
        },0)
        this.chartData={xData,sData}
      })
    },
  },
  created() {
    this.chart()
  }
}
</script>

<style scoped>

</style>
